1. Field of the Invention
The present invention relates to an apparatus for executing a program which contains immediate data, and a program conversion method for generating an instruction which the apparatus can carry out.
2. Description of the Prior Art
In this specification, "a program execution apparatus" means an apparatus which executes a program for processing data, the program having been converted into such a data format that allows the apparatus to execute the program (that is, an instruction expressed in a machine code). A micro processor is a typical example of such an apparatus. The apparatus is not necessarily composed of a single component.
"A program conversion method" means a method for converting a program into such a data format that allows the program execution apparatus to execute the program. Such a method is generally employed by a compiler which uses a high level language. In the following, programs before and after format conversion are both referred to as a program unless it will cause confusion.
A program execution apparatus reads a program from a memory for execution. Accompanying recent developments in electronic products causing them to have complex functions, the size of a program to be executed by such an apparatus has tended to increase, which often causes the cost of program memory hardware to be higher than that of a central processing unit (CPU). Thus, reduction of a program size has been urgently desired.
This is particularly a serious problem when such a program execution apparatus is expected to have a high performance. If a micro processor is taken as an example, the initially developed 8-bit processor has recently been losing its position in the mainstream and is gradually being replaced by 16 or 32 bit processors. As the tendency towards greater bit size becomes more established, the size of a basic instruction code also becomes larger, which resultantly causes an increase in program size.
In order to solve the above problem, a method has been suggested for reducing the basic size of an instruction code to be smaller than the basic size of data to be processed. For instance, Matsushita Electric, Industry Corp. produces a 16-bit micro processor MN10200 which employs an 8-bit code for a basic instruction. Nihon Electric, Corp. produces a 32-bit micro processor V850 which employs a 16-bit code for a basic instruction.
This approach, however, still has a problem with an immediate instruction which is an instruction having immediate data therein. That is, since immediate data which is contained in an immediate instruction is generally large, a single unit of basic instruction code is not sufficient to include such large immediate data. In order to prepare an immediate instruction which contains 8-bit immediate data, the foregoing MN10200 requires an immediate instruction code which is larger than 8 bits, for example 16 bits. When the immediate data is 16 bits, an immediate instruction code must be larger. Since this micro processor is a 16-bit type, the processor would naturally process 16-bit immediate data. The above described situation where a longer immediate instruction code is required in order to contain long immediate data is true with a V850 32-bit micro processor. It should be noted that this situation often exists for other micro processors.